<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="ja" xml:lang="ja">
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<meta http-equiv="Content-Script-Type" content="text/javascript" />
		<meta http-equiv="Content-Style-Type" content="text/css" />
		<meta http-equiv="keywords" content="" />
		<meta http-equiv="description" content="" />
		<title>コントロールパネル</title>

		<link rel="stylesheet" href="./assets/styles/default.css" type="text/css" />
		<script src="assets/scripts/jquery-1.3.2.min.js" type="text/javascript"></script>
		<script src="assets/scripts/menu.js" type="text/javascript"></script>
		
		<script type="text/javascript">
		$(function() {

			// メッセージのフェード
			$('.message').fadeIn("slow");

			// 戻るボタン押下
			$('#btn_back').click(function(){
				document.fm.mode.value = 'back';
				document.fm.submit();
			});
		});
		</script>		
		<script type="text/javascript">
			function controlForm(){
				var load = document.getElementById("load");	
				var update = document.getElementById("update");	
				if({{$cnt}}>0){
					load.style.display = 'none';
					update.style.display = 'block';
				}else{
					load.style.display = 'block';
					update.style.display = 'none';
				}
				if({{$cnt}}==''){
					load.style.display = 'block';
					update.style.display = 'none';
				}
			}
		</script>
	</head>
	<body  onload="controlForm()">
	{{ php }} include( MENU_FILE ); {{ /php }}
		<div id="header" class="clearfix"><div class="wrapper">
			<h1><a href="./">コントロールパネル</a></h1>
			<form id="form_logout" action="logout.php" method="post"><p>{{ $login.staff_name }} <input type="submit" id="button_logout" value="ログアウト" /></p></form>
		</div></div>

		<div id="container"><div class="wrapper">

			<h2>見積管理</h2>
			<ul class="submenu clearfix">
				<li><a href="consumer_index.php">顧客検索</a></li>								
				<li>顧客登録</li>
				<li><a href="price_task.php">見積タスク一覧</a></li>
				<li><a href="price_check.php">見積検索</a></li>
				<li><a href="shop_index.php">商品マスタ</a></li>
			</ul>

{{if $cnt==''}}
<div id="load" >
			<h3>顧客登録</h3>
			{{ if $phase == 'complete' }}
			<p class="message">登録が完了しました</p>
			<ul>
				<li>&gt;&gt; <a href="consumer_index.php">一覧へ戻る</a></li>
			</ul>
			{{ else }}
			<p class="message">必要な情報を入力して、「登録」ボタンをクリックしてください。 </p>
			<form name="fm1" action="consumer_form.php" method="post" >
				
				<table class="formTable">
					<tbody>
						<tr>
 							<th>※種别</th>
							<td>
 								<input type="radio" name="category" value="1" {{ if $forms.category == 1 }}checked="checked"{{ /if }} >法人</input>&nbsp;&nbsp; 
								<input type="radio" name="category" value="2" {{ if $forms.category == 2 }}checked="checked"{{ /if }}>個人</input>
								{{ $err.category }}
							</td>
						</tr>
						<tr>
							<th>※会社名</th>
							<td>
								<input type="text" name="company_name" id="text_information" class="text" value="{{ $forms.company_name }}" />
								{{ $err.company_name }}
							</td>
						</tr>
						<tr>
							<th>※会社名（カタカナ）</th>
							<td>
								<input type="text" name="katakana" id="text_information" class="text" value="{{ $forms.katakana }}"  />
								{{ $err.katakana }}
							</td>
						</tr>
						<tr>
							<th>支店名</th>
							<td>
								<input type="text" name="branch_name" id="text_information" class="text" value="{{ $forms.branch_name }}" />
							</td>
						</tr>

						<tr>
							<th>セールス担当者</th>
							<td>
								<input type="text" name="sal_manager" id="text_information" class="text" value="{{ $forms.sal_manager }}" />
							</td>
						</tr>

						<tr>
							<th>※支払条件</th>
							<td>
								<input type="text" name="payment_term" id="text_information" class="text" value="{{ $forms.payment_term }}" />
								{{ $err.payment_term }}
							</td>
						</tr>
					</tbody>
				</table>

				<p class="button">
					<button type="submit" class="submit"><span>登録</span></button>
				</p>
				<input type="hidden" name="mode" value="input" />
			</form>
			{{ /if }}
</div>			
{{else}}
<div id="update" >
			<h3>顧客更新</h3>	
			{{ if $phase == 'complete' }}
			<p class="message">更新が完了しました</p>
			<ul>
				<li>&gt;&gt; <a href="consumer_index.php?{{php}}echo $_SESSION['consumer_index_search'] ;{{/php}}">一覧へ戻る</a></li>
			</ul>
			{{ else }}
			<p class="message">顧客更新一覧</p>
			<ul>
				<li>&gt;&gt; <a href="consumerInfo.php?consumer_id={{$v.consumer_id}}">一覧へ戻る</a></li>
			</ul>
			<form name="fm2" action="consumer_form.php" method="post">
			<input type="hidden" name="id" value="{{ $v.id }}" />
				<table class="formTable">

					<tbody>
						<tr>
							<th>顧客ID</th>
							<td>{{ $v.id }}</td>
						</tr>
						<tr>
							<th>登録日</th>
							<td>{{ $v.r_date }}</td>
						</tr>
						<tr>
							<th>更新日</th>
							<td>{{ $v.u_date }}</td>
						</tr>
						<tr>
							<th>※種别</th>
							<td>
							<input type="radio" name="category" value="1" {{ if $v.category == 1 }}checked="checked"{{ /if }} >法人</input>&nbsp;&nbsp; 
							<input type="radio" name="category" value="2" {{ if $v.category == 2 }}checked="checked"{{ /if }}>個人</input>
							{{ $err.category }}
							</td>
						</tr>
						<tr>
							<th>※会社名</th>
							<td>
								<input type="text" name="company_name" value="{{$v.company_name}}"  id="text_information" class="text"  />
								{{ $err.company_name }}
							</td>
						</tr>
						<tr>
							<th>※会社名（カタカナ）</th>
							<td>
								<input type="text" name="katakana" value="{{$v.katakana}}" id="text_information" class="text" />
								{{ $err.katakana }}
							</td>
						</tr>
						<tr>
							<th>支店名</th>
							<td>
								<input type="text" name="branch_name" value="{{$v.branch_name}}" id="text_information" class="text" />
							</td>
						</tr>

						<tr>
							<th>セールス担当者</th>
							<td>
								<input type="text" name="sal_manager" value="{{$v.sal_manager}}" id="text_information" class="text" />
							</td>
						</tr>

						<tr>
							<th>※支払条件</th>
							<td>
								<input type="text" name="payment_term" value="{{$v.payment_term}}" id="text_information" class="text" />
								{{ $err.payment_term }}
							</td>
						</tr>
						<input type="hidden" name="consumer_id" value="{{ $v.consumer_id }}" />
						<input type="hidden" name="r_date" value="{{ $v.r_date }}" />
						<input type="hidden" name="u_date" value="{{ $v.u_date }}" />
						<input type="hidden" name="mode" value="update" />

					</tbody>
				</table>
				<p class="button">
					<button type="submit" class="submit"><span>更新</span></button>
				</p>				
			</form>
			{{ /if }}
</div>
{{/if}}

		</div></div>
		<address>Copyright (C) SHIFT Inc. / All rights reserved</address>
	</body>

</html>